Skip to main content

Using gem5

After following the instructions on how to install, you can now set up your environment to use gem5.

The executable for gem5 is located in $GEM_PATH/build/RISCV/gem5.opt if you built according to the instruction, so you may execute the program at that path.

tip

You may want to set alias gem5='nice -n 15 $GEM_PATH/build/RISCV/gem5.opt in your .bashrc so that you can run gem5 more easily from the 429-resources directory and keep all your friends, who are also using ug07 to run gem5, happy.

info

The nice utility decreases the priority of your simulation so that it does not affect users in the graphical environment. You should probably use this most of the time or else you risc (get it) someone restarting your computer because it is slow.

Running a Workload

gem5 requires a script to run. For tutorial purposes, we include the 429-resources/scripts/tutorial folder for you to peruse, however we strongly recommend that you follow the rest of this tutorial to familiarize yourself with creating your own scripts. You will find these skills useful throughout the course.

tip

We provide a Hello World! script for you to verify that your installation of gem5 is correct. You may invoke it from the 429-resources folder with gem5 scripts/tutorial/01_simple_cpu/simple.py. You should see Hello World! tucked in the output near the bottom.

For the assignments we use the SPEC CPU 2017 benchmarks. We have provided binaries as well as a helper script in 429-resources/scripts/Spec.py that you can copy and import into your project directories as you like to help run these benchmarks.